#include "TextureManager.h"
#include <assert.h>

TextureManager::TextureManager()
{
    m_SandTexture = 0;
    m_MudTexture = 0;

    m_AlphamapFull = 0;
    m_AlphamapHalfSide = 0;
    m_AlphamapCircle = 0;
    m_AlphamapCorner = 0;
}

void TextureManager::Init (LPDIRECT3DDEVICE9 device)
{
    D3DXCreateTextureFromFileA (device,"Textures/terrainSand.bmp",&m_SandTexture);
    D3DXCreateTextureFromFileA (device,"Textures/terrainMud.bmp",&m_MudTexture);
    D3DXCreateTextureFromFileA (device,"Textures/textureGreen.bmp",&m_GreenTexture);

    D3DXCreateTextureFromFile(device, "Textures/alphamapFull.tga", &m_AlphamapFull);
    D3DXCreateTextureFromFile(device, "Textures/alphamapFull50.tga", &m_AlphamapFull50);
    D3DXCreateTextureFromFile(device, "Textures/alphamapHalfSide.tga", &m_AlphamapHalfSide);
    D3DXCreateTextureFromFile(device, "Textures/alphamapCircle.tga", &m_AlphamapCircle);
    D3DXCreateTextureFromFile(device, "Textures/alphamapCorner.tga", &m_AlphamapCorner);
}

TextureManager::~TextureManager()
{
    if(m_SandTexture != NULL)       m_SandTexture->Release();
    if(m_MudTexture != NULL)        m_MudTexture->Release();
    if(m_AlphamapFull != NULL)      m_AlphamapFull->Release();
    if(m_AlphamapFull50 != NULL)    m_AlphamapFull50->Release();
    if(m_AlphamapHalfSide != NULL)  m_AlphamapHalfSide->Release();
    if(m_AlphamapCircle != NULL)    m_AlphamapCircle->Release();
    if(m_AlphamapCorner != NULL)    m_AlphamapCorner->Release();
    if(m_GreenTexture != NULL)      m_GreenTexture->Release();

}





